<template>
  <div>
    <h1>展示的内容：{{ msg }}</h1>
    <input type="text" @keyup.enter="keyfun" v-model="neirong" />
    <hr />
    <img :src="url" style="width: 200px" /><br />
    <input type="file" @change="fun" />
  </div>
</template>
<script>
export default {
  data() {
    return {
      msg: '',
      neirong: '',
      url: '',
    }
  },
  methods: {
    keyfun() {
      this.msg = this.neirong
      this.neirong = ''
    },
    fun(e) {
      // console.log(e.target.files[0])
      const file = e.target.files[0]
      this.url = URL.createObjectURL(file)
    },
  },
}
</script>
